package base.day05;

import java.util.Scanner;

public class Study1 {
    public static void main(String[] args) {
        //等差数列求前n项和
        Scanner sc=new Scanner(System.in);
        System.out.println("请输入要求和的项数：");
        int n =sc.nextInt();
        int sum=0;
        for (int i=1;i<=n;i++){
            sum+=i;
        }
        System.out.println(sum);
    }
}
